<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="../language.jsp" %>
    <%
    response.setHeader("Cache-Control","no-store");
    response.setHeader("Pragrma","no-cache");
    response.setDateHeader("Expires",0);
    
    if(session.getAttribute("password2")==null){
    	response.sendRedirect( "login2.jsp?pageUrl=user/xpTree.jsp");
    	return;
    }
    
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title><fmt:message key="i18n.salesTotal"/>-<fmt:message key="i18n.title"/> </title>
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1" />
	
	<link rel="shortcut icon" href="../index/favicon.png" />
	
	<!-- bootstrap -->
    <link href="css/bootstrap/bootstrap.css" rel="stylesheet" />
    <link href="css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
    <link href="css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet" />

    <!-- global styles -->
    <link rel="stylesheet" type="text/css" href="css/elements.css" />
    <link rel="stylesheet" type="text/css" href="css/icons.css" />
	 
	<link rel="stylesheet" href="../styles/myStyle.css" />
</head>
<body>
<body>
	<!-- main container -->
	<div class="content container-fluid">
		<!-- BreadcrumbNavigation -->
        <div class="row-fluid head">
            <div class="span12">
                <h4><fmt:message key="i18n.yewuManage"/> &gt; <fmt:message key="i18n.teamTreePicture"/></h4>
            </div>
        </div>
        <!-- End BreadcrumbNavigation -->
        <div style="min-height: 620px;" id="xp_tree"></div>
	</div>
	

	<script type="text/javascript" src="../scripts/jquery/jquery-1.4.2.min.js"></script>
	<script src="../scripts/jquery/easyui/jquery.easyui.min.js"></script>
	<script src="../scripts/jstree/js/lib/jquery.cookie.js"></script>
	<script src="../scripts/jstree/js/lib/jquery.hotkeys.js"></script>
	<script src="../scripts/jstree/js/jquery.jstree.js"></script>
	<script src="../scripts/jstree/js/rewritejstree.js"></script>
	
	<script>
	
	function viewUserInfo(userNo){
		$.post('user!findUserInfo.action','userDTO.userNo='+userNo,function(data){
			var msg='User information(用户信息)：\n'+
			'Member number(会员编号):'+data.userNo+'\n'+
			'Member name(会员昵称):'+data.userName+'\n'+
			'Real name(真实姓名):'+data.fullName+'\n'+
			'Card ID(身份证):'+data.cardId+'\n'+
			'Contact QQ(联系QQ号):'+data.qqNumber+'\n'+
			'Telephone number(电话号码):'+data.phone+'\n'
			'The remitting bank(汇款银行):'+data.bank+'-'+data.bankInfo+'\n'+
			'Bank account name(银行戶名):'+data.openBankName+'\n'+
			'Bank account(银行账号):'+data.bankNumber+'\n'+
			'Pay treasure(支 付 宝):'+data.alipayNumber+'\n'+
			'TenPay(财 付 通):'+data.tenpayNumber+'\n'+
			'The membership grade(会员级别):'+data.level+'级\n'
			alert(msg);
		});
	}
	function viewXPTree(loginName){
		var lang = "${cookie['language'].value?'zh_CN':cookie['language'].value}";
		 $('#xp_tree').html('');
		 $('#xp_tree').jstree({
				json_data: {
					ajax: {
					  type:"post",
					  url : "registerUser!findXPTree.action?lang="+'zh_CN',
					  data:function(n){
				    	  return {'registerUserDTO.loginName':n.attr ? n.attr("loginName").replace("node_",""):loginName,"dtype":n.attr ? "sub":"all"};//types is in action
				      },
	                  dataType: 'json',
	                  cache:false
				 	}
				},
			"plugins" : [ "themes", "json_data", "ui", "crrm","dnd", "search", "types", "hotkeys"]
		})
		//.bind('loaded.jstree', function(e,data){data.inst.open_all(1);})
		.bind("select_node.jstree", function(e,data){
			if(data.rslt.obj.attr('newReg')=='newReg'){
				//alert(data.rslt.obj.attr('topuser')+"--"+data.rslt.obj.attr('businessDirection'));
				window.location='reg.jsp?contactNo='+data.rslt.obj.attr('contactNo')+'&registerLocation='+data.rslt.obj.attr('registerLocation');
			}else{
				//viewUserInfo(data.rslt.obj.attr('userNo'));
			}
		 });
	}
	
	
	$(function(){
		viewXPTree('${session.loginName}');
	});
	
	</script>


</body>
</html>